import http from '@/utils/http'
// 得到首页导航栏数据
export const getChannels = () => {
  console.log(111)
  return http({
    method: 'GET',
    url: 'app/v1_0/user/channels'
  })
}
// 得到频道编辑数据
export const getEditChannels = () => {
  return http({
    method: 'POST',
    url: 'app/v1_0/user/channels'
  })
}
// 获取所有频道
export const getAllChannels = () => {
  return http({
    method: 'GET',
    url: '/app/v1_0/channels'
  })
}
// 增加频道
export const addChannels = (channels) => {
  return http({
    method: 'PATCH',
    url: '/app/v1_0/user/channels',
    data: {
      channels
    }
  })
}
// 删除频道
export const delChannels = (channelId) => {
  return http({
    method: 'DELETE',
    url: `/app/v1_0/user/channels/${channelId}`
  })
}
// 搜索联想
export const getSearchAssociate = (q) => {
  return http({
    method: 'GET',
    url: '/app/v1_0/suggestion',
    params: {
      q
    }
  })
}
// 搜索结果
export const getSearchData = (params) => {
  return http({
    method: 'GET',
    url: '/app/v1_0/search',
    params
  })
}
// 获取用户搜索历史
export const getSearchHistory = () => {
  return http({
    method: 'GET',
    url: '/app/v1_0/search/histories'
  })
}

// 删除用户历史记录
export const delSearchHistory = () => {
  return http({
    method: 'DELETE',
    url: '/app/v1_0/search/histories'
  })
}
